﻿namespace Raven
{
    public class AttackTargetGoalEvaluator : GoalEvaluator
    {
        public AttackTargetGoalEvaluator(Fix characterBias) : base(characterBias)
        {
        }

        public override Fix CalculateDesirability(RavenBot pBot)
        {
            Fix Desirability = 0;

            //only do the calculation if there is a target present
            if (pBot.GetTargetSys().isTargetPresent()) 
            {
                Fix Tweaker = 1;

                Desirability = Tweaker *
                               RavenFeature.Health(pBot) * 
                               RavenFeature.TotalWeaponStrength(pBot);

                //bias the value according to the personality of the bot
                Desirability *= _characterBias;
            }
    
            return Desirability;
        }

        public override void SetGoal(RavenBot pBot)
        {
            pBot.GetBrain().AddGoalAttackTarget(); 
        }
    }
}